#include <iostream>
#include <string>

using namespace std;

int main()
{
    string str;
    cin >> str;

    int len = str.size();
    bool flag = true, flag1 = true;

    if (len % 2 == 0) {
        int left = (len / 2) - 1, right = (len / 2);

        for (int i = left; i >= 0; i--) {
            if (str[right] != str[right - 1]) {
                flag1 = false;
            }
            if (str[i] != str[right]) {
                flag = false;
                break;
            }
            right++;
        }
    }
    else {    // abcde
        int left = (len / 2) - 1, right = (len / 2) + 1;

        for (int i = left; i >= 0; i--) {

            if (str[right] != str[right - 1]) {
                flag1 = false;
            }
            if (str[i] != str[right]) {
                flag = false;
                break;
            }
            right++;
        }
    }

    if (flag1) {
        cout << 1 << endl;
        return 0;
    }

    if (len == 1) {
        cout << 1 << endl;
        return 0;
    }

    if (flag) {
        cout << len - 1 << endl;
    }
    else {
        cout << len << endl;
    }
    return 0;
}